home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / clonecd / September 93.img / Archives / Applications / Calculators / AxoCalculator / AxoCalculator AutoLoad / Stock Concentration < prev    next >
Text File  |  1993-02-02  |  2KB  |  70 lines

  1. LocalLanguage Pascal
  2. {-------------------------------------------------
  3. This document contains a procedure for converting
  4. between solution concentration and solute weight, 
  5. taking into account the volume of water and the
  6. molecular weight of the solute.
  7.  
  8. •  To load this function choose "Select All" under 
  9.     the "Edit" menu, then press "enter". 
  10.  
  11. --------------------------------------------------}
  12. Var
  13.     molecularWeight, Volume, Concentration, Weight: Real
  14.     
  15. {• Single channel properties  •}
  16. procedure Solution
  17. Var
  18.     done:    Boolean
  19. begin
  20.     done = False
  21.     Repeat
  22.         PoseDialog ('\rCalculate volume, weight or concentration of a solution.\rSet unknown parameter to zero',
  23. &            'Molecular Weight', molecularWeight, 
  24. &            'Volume : ml', Volume,
  25. &            'Concentration : mM',Concentration, 
  26. &            'Weight : g',Weight)
  27.     
  28.         if molecularWeight = 0 then        { calculate molecular weight }
  29.         begin
  30.             molecularWeight = 1e6* Weight / (Volume * Concentration)
  31.             done = True
  32.         end
  33.         else
  34.         begin
  35.             if Volume = 0 then        { calculate Volume in ml }
  36.             begin
  37.                 Volume = 1e6* Weight / (molecularWeight * Concentration)
  38.                 done = True
  39.             end
  40.             else
  41.             begin
  42.                 if Concentration = 0 then        { calculate drug concentration in mM }
  43.                 begin
  44.                     Concentration = 1e6* Weight / (molecularWeight * Volume)
  45.                     done = True
  46.                 end
  47.                 else        
  48.                 begin    
  49.                     if Weight = 0 then        { calculate weight in g }
  50.                     begin
  51.                         Weight = Concentration * molecularWeight * Volume / 1e6
  52.                         done = True
  53.                     end
  54.                 end
  55.             end
  56.         end
  57.         if done then
  58.         begin
  59.             writeln ('Molecular Wt. \t\t',molecularWeight)
  60.             writeln ('Volume           \t',Volume, ' ml')
  61.             writeln ('Concentration \t',Concentration, ' mM')
  62.             writeln ('Weight            \t',Weight, ' g')
  63.         end
  64.         else
  65.         begin
  66.             Alert ('No calculation was performed.\nPlease set the unknown value to zero.')
  67.         end
  68.     Until done
  69. end
  70.